"""Create user_info table with correct ID type

Revision ID: b93f8aa0cb06
Revises: 
Create Date: 2025-09-10 21:24:14.564893

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'b93f8aa0cb06'
down_revision: Union[str, Sequence[str], None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('user_info',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False, comment='id'),
    sa.Column('username', sa.String(length=50), nullable=True, comment='用户名'),
    sa.Column('password', sa.String(length=500), nullable=True, comment='密码'),
    sa.Column('nick_name', sa.String(length=100), nullable=True, comment='昵称'),
    sa.Column('phone', sa.String(length=17), nullable=True, comment='电话号码'),
    sa.Column('email', sa.String(length=100), nullable=True, comment='邮箱'),
    sa.Column('avatar', sa.String(length=200), nullable=True, comment='头像'),
    sa.Column('sex', sa.SmallInteger(), nullable=True, comment='性别'),
    sa.Column('open_id', sa.String(length=45), nullable=True, comment='微信open id'),
    sa.Column('union_id', sa.String(length=45), nullable=True, comment='微信开放平台unionID'),
    sa.Column('last_login_ip', sa.String(length=50), nullable=True, comment='最后一次登录ip'),
    sa.Column('last_login_time', sa.DateTime(), nullable=True, comment='最后一次登录时间'),
    sa.Column('status', sa.SmallInteger(), nullable=True, comment='状态：1为正常，0为禁止'),
    sa.Column('create_time', sa.TIMESTAMP(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False, comment='创建时间'),
    sa.Column('create_by', sa.BigInteger(), nullable=True),
    sa.Column('update_time', sa.TIMESTAMP(), server_default=sa.text('(CURRENT_TIMESTAMP)'), nullable=False, comment='更新时间'),
    sa.Column('update_by', sa.BigInteger(), nullable=True, comment='更新者'),
    sa.Column('del_flag', sa.CHAR(length=1), nullable=False, comment='删除标志（0代表存在 2代表删除）'),
    sa.Column('remark', sa.String(length=255), nullable=True, comment='备注'),
    sa.PrimaryKeyConstraint('id'),
    comment='会员表',
    mysql_charset='utf8mb4',
    mysql_collate='utf8mb4_0900_ai_ci',
    mysql_engine='InnoDB',
    mysql_row_format='DYNAMIC'
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('user_info')
    # ### end Alembic commands ###
